#include<iostream>

using namespace std;

int main()
{
	int L = 0, R = 0;
	cin >> L >> R;
	int count = 0;
	for (int i = L; i <= R; i++)
	{
		int num = i;
		while (num)
		{
			if (num % 10 == 2)
			{
				count++;
				num /= 10;
			}
			else
			{
				num /= 10;
			}
		}
	}
	cout << count << endl;
	return 0;
}